import { NgModule, ModuleWithProviders } from "@angular/core";
import { CommonModule } from "@angular/common";
import { RouterModule } from "@angular/router";

import { Iwe7FormBuilderService } from "./iwe7-form-builder.service";
import { CreateModalComponent } from "./create-modal/create-modal.component";
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { Iwe7FormBuilderComponent } from "./iwe7-form-builder/iwe7-form-builder.component";

import { Iwe7ToolsModule } from "../iwe7-tools/iwe7-tools.module";
import { CreateTableComponent } from "./create-table/create-table.component";
import { DataListComponent } from "./data-list/data-list.component";
import { FormPreviewComponent } from "./form-preview/form-preview.component";
import { Iwe7FormPreviewModule } from "../iwe7-form-preview/iwe7-form-preview.module";
@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    Iwe7ToolsModule.forChild(),
    Iwe7FormPreviewModule,
    RouterModule.forChild([
      {
        path: "",
        component: Iwe7FormBuilderComponent
      },
      {
        path: "index",
        component: Iwe7FormBuilderComponent
      },
      {
        path: "formList",
        component: Iwe7FormBuilderComponent
      },
      {
        path: "dataList",
        component: DataListComponent
      },
      {
        path: "createTable",
        component: CreateTableComponent
      },
      {
        path: "createForm",
        component: CreateModalComponent
      },
      {
        path: "preview",
        component: FormPreviewComponent
      }
    ])
  ],
  declarations: [
    CreateModalComponent,
    Iwe7FormBuilderComponent,
    CreateTableComponent,
    DataListComponent,
    FormPreviewComponent
  ]
})
export class Iwe7FormBuilderModule {
  public static forRoot(): ModuleWithProviders {
    return {
      ngModule: Iwe7FormBuilderModule,
      providers: [Iwe7FormBuilderService]
    };
  }
}
